import request from '@/utils/request'

export function edit(data) {
  return request({
    url: 'api/periodTask/edit',
    method: 'put',
    data
  })
}

export function del(data) {
  return request({
    url: 'api/periodTask/del',
    method: 'delete',
    data
  })
}

export function batchChangeStatus(data) {
  return request({
    url: 'api/periodTask/batchUpdateTaskStatus',
    method: 'post',
    data
  })
}

export function qryTaskInfoByAppCode() {
  return request({
    url: 'api/periodTask/qryTaskInfoByAppCode',
    method: 'get'
  })
}

export function getDependTaskByCurrentApp(data) {
  return request({
    url: 'api/periodTaskDef/getDependTaskByCurrentApp',
    method: 'post',
    data
  })
}

export function getTask() {
  return request({
    url: 'api/periodTaskDef/getTaskList?page=0&size=10&sort=sort%2Casc&sort=id%2Cdesc',
    method: 'get'
  })
}

export function getTaskListByCurrentApp() {
  return request({
    url: 'api/periodTaskDef/getTaskListByCurrentApp',
    method: 'get'
  })
}

export function batchUpdateTaskInf(data) {
  return request({
    url: 'api/periodTaskDef/batchUpdateTaskInf',
    method: 'post',
    data
  })
}

export function batchUpdateTaskByJobCode(data) {
  return request({
    url: 'api/periodTaskDef/batchUpdateTaskByJobCode',
    method: 'post',
    data
  })
}

export function getTaskList(data) {
  return request({
    url: 'api/periodTask/getTaskList',
    method: 'post',
    data
  })
}

export function upDependChat(taskCode, bizDate, showType) {
  return request({
    url: 'api/periodTask/upDependChat/' + taskCode + '/' + bizDate + '/' + showType,
    method: 'get'
  })
}

export function upDependList(taskCode, bizDate) {
  return request({
    url: 'api/periodTask/upDependList/' + taskCode + '/' + bizDate,
    method: 'get'
  })
}

export function downDependChat(taskCode, bizDate, showType) {
  return request({
    url: 'api/periodTask/downDependChat/' + taskCode + '/' + bizDate + '/' + showType,
    method: 'get'
  })
}

export function downDependList(taskCode, bizDate) {
  return request({
    url: 'api/periodTask/downDependList/' + taskCode + '/' + bizDate,
    method: 'get'
  })
}

export default {
  edit, del, qryTaskInfoByAppCode, batchChangeStatus, getTaskListByCurrentApp, batchUpdateTaskInf,
  batchUpdateTaskByJobCode, getTaskList, getDependTaskByCurrentApp, getTask,
  upDependChat, upDependList, downDependChat, downDependList
}
